//轮播图
app.directive("mySwiper", function (){
	return{
		restrict:"ECMA",
		replace:true,
		template:`
			<div class="swiper-container">
				<div class="swiper-wrapper">
				    <div class="swiper-slide" ng-repeat="url in imgs">
				       	<img ng-src="{{ url.activity.img }}">
				    </div>
				</div>
				    <!-- 如果需要分页器 -->
				    <div class="swiper-pagination"></div>			    
			</div>
		`,
		controller:function ($scope,$http){
			//请求数据
			$http({
				method:'get',
				url:"http://h5.yztctech.net/api/axf/apihome.php "
			}).then(function (res) {
				console.log(res)
				var imgsData = res.data.data.slide;
					$scope.imgs = imgsData;
				
			})		
			//swiper轮播设置
			var mySwiper = new Swiper ('.swiper-container', {
		    direction: 'horizontal', //横向轮播
		    loop: true,
		    autoplay:2000,  //自动每秒切换一次
		    observer:true,
		    
		    // 如果需要分页器
//		    pagination: '.swiper-pagination'
					
		})
		}
		
	}
})